import cv2
import numpy as np
from matplotlib import pyplot as plt
import random,time
from PIL import ImageGrab
import pyautogui
import cv2
import numpy as np
import time
from 子函数 import yinru
from 子函数.yinru import cs,zd ,yqfy,jr ,zb ,js ,sb ,yh ,ts ,bqds ,zd1 ,cjdw ,cj ,kszd ,qd ,jjtp ,jg ,yq ,di2zhang,di3zhang ,di4zhang ,di5zhang
from 子函数.yinru import di20zhang ,di21zhang ,di22zhang ,di23zhang ,ts1 ,daotubiao ,daotubiao1 ,zhanliping ,huodejiangli ,zaizhanchang ,haifangzhu ,sx ,tz ,xiaomao
from 子函数.yinru import jiejietupo ,liuxunzhang,jieshu,danjujieshu,qr1,时间下限,时间上限,feiliuxing,jieshou,time3,jingyanman,qx

def 经验满():
    # 经验满
    img_rgb = np.array(ImageGrab.grab().convert('RGB'))#屏幕截图
    img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
    # 经验满
    res = cv2.matchTemplate(img_gray, jingyanman, cv2.TM_CCOEFF_NORMED)  # 大图 ，目标 ，模式
    threshold = 0.8  # 阈值 图片相识度
    loc = np.where(res >= threshold)
    for pt in zip(*loc[::-1]):
        # cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0, 0, 255), )#在图片选中位置画线框
        pyautogui.moveTo(846, 536)  # 鼠标移动到坐标位置
        pyautogui.click()  # 鼠标点击
        print("当天不提醒")
        time.sleep(random.randint(时间下限, 时间上限))
        # 取消
        img_rgb = np.array(ImageGrab.grab().convert('RGB'))  # 屏幕截图
        img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
        res = cv2.matchTemplate(img_gray, qx, cv2.TM_CCOEFF_NORMED)  # 大图 ，目标 ，模式
        threshold = 0.8  # 阈值 图片相识度
        loc = np.where(res >= threshold)
        for pt in zip(*loc[::-1]):
            # cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0, 0, 255), )#在图片选中位置画线框
            pyautogui.moveTo(int(pt[0]) + 10, int(pt[1]) + 10)  # 鼠标移动到坐标位置
            pyautogui.click()  # 鼠标点击
            print("取消")
            break
        break

